home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / SHELLS / TPSHELL / SUBPROC.PAS < prev   
Pascal/Delphi Source File  |  1986-05-23  |  1KB  |  34 lines

  1. { This program calls COMMAND.COM to interpret whatever command
  2.   is given in its parameter string.
  3.  
  4.   It can be used to execute a .BAT file from inside another .BAT file.
  5.  
  6.   It uses the include file SHELL.PAS to handle the DOS interface.
  7.  
  8.   It also demonstrates a nice trick for getting the entire parameter
  9.   string as one string by looking in DOS's area.
  10.  
  11.   *** NOTE 1 *** SET, PROMPT, and PATH commands will not work.
  12.   *** NOTE 2 *** To compile this you must set the options to limit
  13.     the total amount of of heap storage ("free dynamic memory")
  14.     used by this program so some memory will be left for the command.
  15.     $40 paragraphs (1K) is sufficient for this very simple program. }
  16.  
  17. { This program was written by:
  18.          Bill Mayne
  19.          9707 Lawndale Dr.
  20.          Silver Spring, MD  20901
  21.          (301)899-4845 (answering machine) }
  22.  
  23. program subproc;
  24. {$I shell   }
  25.  
  26. var
  27.   i:integer;
  28.   cmdstr:ShellStr; {defined as string[127] by the include}
  29. begin
  30.   move(Mem[CSeg:$81],cmdstr,128); {get parameter string from DOS}
  31.   shell(cmdstr,i);
  32.   Halt(i);
  33.   end.
  34.